#include<iostream>
#include<string>
#include<vector>
using namespace std;
typedef long long LL;
const int N = 1e3 + 10;
int n;
int a[N];
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> n;
		if (n == 1) {
			cout << -1 << endl;
			continue;
		}
		vector<int>ans;
		int idx = 1;
		bool flag = 0;
		for (int i = 1; i <= n; i++) {
			cin >> a[i];
			if (a[i] == i && !flag) {
				idx = i;
				flag = 1;
			}
		}
		for (int i = 1; i <= n; ) {
			if (a[i] == i) {
				if (i + 1 != n - 1 || a[n] != n) {
					cout << i + 1 << " " << i << " ";
					i += 2;
				}
				else if (i + 1 == n - 1 && a[n] == n) {
					cout << i + 1 << " " << n << " " << i << " ";
					break;
				}
			}
			else {
				cout << i << " ";
				i++;
			}
		}
		cout << endl;
	}
	return 0;
}